<?php
/**
 * Created by PhpStorm.
 * User: zhang-hong
 * Date: 2017/3/27
 * Time: 17:32
 */
class DelxunchadataController extends Yaf_Controller_Abstract
{
    public function IndexAction()
    {
        $request = $this->getRequest();
        $id = $request->getPost("id","");
        $yiyuan_id = $request->getPost("yiyuan_id","");

        //医院id判断
        if($yiyuan_id === "")
        {
            Utility::apiJsonError(20028, '请输入医院ID');
        }
        elseif(!ctype_digit("$yiyuan_id"))
        {
            Utility::apiJsonError(20027, '医院ID必须是整型');
        }


        if($id === "")
        {
            Utility::apiJsonError(20028, 'ID为空');
        }
        elseif(!ctype_digit("$id"))
        {
            Utility::apiJsonError(20027, 'ID必须是整型');
        }
        $query = DB::delete('zhuyuan_xuncha_jilu')
            ->where('id', '=', $id)
            ->and_where("yiyuan_id","=",$yiyuan_id)
            ->execute();
        $data['error'] = 200;
        $data['msg'] = "";
        if($query){
            $data['state'] = 1;
        }else{
            $data['state'] = 0;
        }
        Utility::apiJsonResultExtends($data);

    }
}